#pragma once

#include <process.h>
#include <atlsync.h>
#include <boost\signal.hpp>
#include <DShow.h>
#include "Ievent.h"

typedef boost::function<void(long)> pFunc_void_long;
typedef boost::function<void(const std::exception&)> pFunc_void_rConstException;


namespace DSP
{
	class eventNotification :
		public Ievent
	{
	private:
		ATL::CComPtr<IMediaEvent> pEvent;
		boost::signal<void (long)> sigEventOccur;
		boost::signal<void (const std::exception&)> sigErrorOccur;
		ATL::CHandle hThread;
		ATL::CEvent eStopNotif;
		HANDLE hGraphEvent;
	public:
		eventNotification(ATL::CComPtr<IMediaEvent>& Event, pFunc_void_long funcEventProcess, pFunc_void_rConstException funcErrorProcess);
		~eventNotification(void);
		void startEventNotification(void);
		void stopEventNotification(void);
		void sendingEvent(void);
		void signallingErrorOccur(const std::exception& ex);
		HANDLE getStopNotifHandle(void);
		HANDLE getGraphEventHandle(void);
	};
}